Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,6 @@
|
|
1 |
import gradio
|
2 |
-
import requests
|
3 |
-
from bs4 import BeautifulSoup
|
4 |
from transformers import pipeline
|
5 |
|
6 |
-
# Function to scrape information from a website
|
7 |
-
def scrape_website(prompt, website_link):
|
8 |
-
response = requests.get(website_link)
|
9 |
-
soup = BeautifulSoup(response.content, "html.parser")
|
10 |
-
|
11 |
-
# Implement your web scraping logic here
|
12 |
-
# Extract the desired information from the HTML
|
13 |
-
|
14 |
-
scraped_info = "Scraped information from the website"
|
15 |
-
return scraped_info
|
16 |
-
|
17 |
# Function to generate chatbot responses
|
18 |
def generate_chatbot_response(prompt):
|
19 |
chatbot = pipeline("text-generation", model="EleutherAI/gpt-neo-2.7B")
|
@@ -21,18 +8,17 @@ def generate_chatbot_response(prompt):
|
|
21 |
return chatbot_response
|
22 |
|
23 |
# Function to handle the web app logic
|
24 |
-
def
|
25 |
-
#scraped_info = scrape_website(prompt, website_link)
|
26 |
chatbot_response = generate_chatbot_response(prompt)
|
27 |
return {"Chatbot Response": chatbot_response}
|
28 |
|
29 |
# Create the Gradio interface
|
30 |
iface = gradio.Interface(
|
31 |
-
fn=
|
32 |
-
inputs=
|
33 |
-
outputs=
|
34 |
-
title="
|
35 |
-
description="Enter a prompt
|
36 |
)
|
37 |
|
38 |
# Run the Gradio app
|
|
|
1 |
import gradio
|
|
|
|
|
2 |
from transformers import pipeline
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
# Function to generate chatbot responses
|
5 |
def generate_chatbot_response(prompt):
|
6 |
chatbot = pipeline("text-generation", model="EleutherAI/gpt-neo-2.7B")
|
|
|
8 |
return chatbot_response
|
9 |
|
10 |
# Function to handle the web app logic
|
11 |
+
def chatbot_app(prompt):
|
|
|
12 |
chatbot_response = generate_chatbot_response(prompt)
|
13 |
return {"Chatbot Response": chatbot_response}
|
14 |
|
15 |
# Create the Gradio interface
|
16 |
iface = gradio.Interface(
|
17 |
+
fn=chatbot_app,
|
18 |
+
inputs="text",
|
19 |
+
outputs="text",
|
20 |
+
title="Chatbot App",
|
21 |
+
description="Enter a prompt to generate a chatbot response."
|
22 |
)
|
23 |
|
24 |
# Run the Gradio app
|