File size: 828 Bytes
e7ec2ae
58861f6
e7ec2ae
58861f6
e7ec2ae
58861f6
 
 
 
 
e7ec2ae
58861f6
 
 
 
 
 
 
e7ec2ae
 
58861f6
e7ec2ae
 
58861f6
 
e7ec2ae
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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()