Spaces:
Build error

financial-rag-chatbot / src /gradio_interface.py
Amit
Deploying to hugging face space
1ac6557
Raw History Blame Contribute Delete
473 Bytes
import gradio as gr
from transformers import pipeline
# Load a pre-trained sentiment analysis model
classifier = pipeline("sentiment-analysis")
# Define the function to process user input
def analyze_sentiment(text):
result = classifier(text)[0]
return f"Label: {result['label']}, Confidence: {result['score']:.2f}"
# Create Gradio Interface
interface = gr.Interface(fn=analyze_sentiment, inputs="text", outputs="text")
# Run the app locally
interface.launch()