Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from transformers import pipeline
|
2 |
from bs4 import BeautifulSoup
|
3 |
import requests
|
|
|
4 |
|
5 |
def extract_text_from_url(url):
|
6 |
response = requests.get(url)
|
@@ -13,10 +14,12 @@ def answer_question(context, question):
|
|
13 |
'context': context,
|
14 |
'question': question
|
15 |
})
|
16 |
-
return answer
|
17 |
|
18 |
-
|
19 |
-
webpage_text = extract_text_from_url(
|
|
|
|
|
20 |
|
21 |
-
|
22 |
-
|
|
|
1 |
from transformers import pipeline
|
2 |
from bs4 import BeautifulSoup
|
3 |
import requests
|
4 |
+
import gradio as gr
|
5 |
|
6 |
def extract_text_from_url(url):
|
7 |
response = requests.get(url)
|
|
|
14 |
'context': context,
|
15 |
'question': question
|
16 |
})
|
17 |
+
return answer['answer']
|
18 |
|
19 |
+
def app(url, question):
|
20 |
+
webpage_text = extract_text_from_url(url)
|
21 |
+
answer = answer_question(webpage_text, question)
|
22 |
+
return answer
|
23 |
|
24 |
+
iface = gr.Interface(fn=app, inputs=["text", "text"], outputs="text")
|
25 |
+
iface.launch()
|