import gradio as gr from bertopic import BERTopic model_name = "RichieBurundi/Ariginalmodel" try: model = BERTopic.load(model_name) except Exception as e: print(f"Error loading model: {e}") # Здесь можно добавить fallback логику или использовать другую модель def generate_text(input_text): try: topics, probs = model.transform([input_text]) generated_text = model.generate_topic_labels(topics[0], probs[0], top_n=1)[0] return generated_text except Exception as e: return f"Error generating text: {e}" iface = gr.Interface( fn=generate_text, inputs="text", outputs="text", title="Ariginal Model Text Generation", description="Enter your text, and the model will generate a response." ) iface.launch()