flatindo commited on
Commit
06e1e0a
·
1 Parent(s): e77cee6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -20
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 web_app(prompt, website_link):
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=web_app,
32
- inputs=["text", "text"],
33
- outputs=["text", "text"],
34
- title="Web Scraping and Chatbot App",
35
- description="Enter a prompt and a website link to scrape information and generate a chatbot response."
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