Spaces:
Sleeping
Sleeping
Delete gradio_app.py
Browse files- gradio_app.py +0 -27
gradio_app.py
DELETED
|
@@ -1,27 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from transformers import pipeline
|
| 3 |
-
|
| 4 |
-
# Step 1: Load the pre-trained model
|
| 5 |
-
# You can choose any suitable conversational model from the Hugging Face Model Hub
|
| 6 |
-
chatbot = pipeline("conversational", model="EleutherAI/gpt-neo-2.7B")
|
| 7 |
-
|
| 8 |
-
# Step 2: Define the function that will process user input and return the model's response
|
| 9 |
-
def respond(input_text):
|
| 10 |
-
conversation = chatbot([input_text])
|
| 11 |
-
return conversation[0]["generated_text"]
|
| 12 |
-
|
| 13 |
-
# Step 3: Create a Gradio interface
|
| 14 |
-
# This interface will take text input from the user and display the chatbot's response
|
| 15 |
-
iface = gr.Interface(
|
| 16 |
-
fn=respond, # The function to call when the user submits input
|
| 17 |
-
inputs="text", # The type of input (text)
|
| 18 |
-
outputs="text", # The type of output (text)
|
| 19 |
-
title="HugChat - Your AI Chatbot", # The title of your chatbot
|
| 20 |
-
description="Chat with an AI-powered bot based on a pre-trained model." # A short description
|
| 21 |
-
)
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
# Step 4: Launch the interface
|
| 26 |
-
if __name__ == "__main__":
|
| 27 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|