File size: 438 Bytes
4fca131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr
from transformers import pipeline

# Load FinGPT model from Hugging Face
model = pipeline("text-generation", model="FinGPT")

# Define the chat function
def chat(input_text):
    response = model(input_text, max_length=50, num_return_sequences=1)
    return response[0]['generated_text']

# Create a Gradio interface
iface = gr.Interface(fn=chat, inputs="text", outputs="text", title="FinGPT Chatbot")

iface.launch()