Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| chat_pipe = pipeline("conversational", model="alpindale/goliath-120b") | |
| # Define a function to generate responses | |
| def generate_response(user_input): | |
| # Generate response from the chat pipeline | |
| response = chat_pipe(user_input)[0]['generated_responses'][0] | |
| return response | |
| # Create Gradio Interface | |
| iface = gr.Interface( | |
| fn=generate_response, | |
| inputs=gr.Textbox(), | |
| outputs=gr.Textbox(), | |
| live=True, | |
| title="Conversational Chat", | |
| description="Chat with the AI model using Gradio!" | |
| ) | |
| # Launch the Gradio interface | |
| iface.launch() | |