import gradio as gr | |
from transformers import pipeline | |
# Load the model | |
model = pipeline("text-generation", model="AdaptLLM/finance-chat") | |
def generate_response(query): | |
response = model(query, max_length=100) | |
return response[0]['generated_text'] | |
# Create Gradio interface | |
iface = gr.Interface( | |
fn=generate_response, | |
inputs=gr.Textbox(lines=2, placeholder="Enter your query here..."), | |
outputs="text", | |
title="Finance Chat" | |
) | |
iface.launch() | |