Update app.py
Browse files
app.py
CHANGED
@@ -1,33 +1,8 @@
|
|
1 |
|
2 |
-
###Implement a question answering system using Gradio's lower-level API. The system features two input fields: the first for the context and the second for the user's question. The system then outputs the model's response
|
3 |
-
|
4 |
-
|
5 |
#Import libraries
|
6 |
import gradio as gr
|
7 |
|
8 |
|
9 |
-
# Load the question-answering pipeline #using deepset/roberta-base-squad2 model
|
10 |
-
qa_model = pipeline("question-answering", model="deepset/roberta-base-squad2")
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
# List of questions #sample questions that users might ask
|
15 |
-
questions = [
|
16 |
-
"What is cryptocurrency and how is it secured?",
|
17 |
-
"Can you explain how blockchain technology is related to cryptocurrencies?",
|
18 |
-
"What are the different types of cryptocurrencies and their purposes?",
|
19 |
-
"Are cryptocurrencies legal, and how does their legal status vary by country?",
|
20 |
-
"What safety measures should I consider when investing in cryptocurrencies?",
|
21 |
-
"What are the advantages and disadvantages of investing in cryptocurrencies?",
|
22 |
-
"How can I buy cryptocurrencies, and what are the options available?",
|
23 |
-
"How does the regulatory landscape affect the use and investment in cryptocurrencies?",
|
24 |
-
"What are the risks associated with investing in cryptocurrencies, and how can I mitigate them?",
|
25 |
-
"Can you provide a summary of the key points about cryptocurrency?"
|
26 |
-
]
|
27 |
-
|
28 |
-
# Print the questions #sample questions that users might ask
|
29 |
-
for i, question in enumerate(questions, 1):
|
30 |
-
print(f"Question {i}: {question}")
|
31 |
|
32 |
# Define a function to get the model's response
|
33 |
def get_response(context, question):
|
|
|
1 |
|
|
|
|
|
|
|
2 |
#Import libraries
|
3 |
import gradio as gr
|
4 |
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
# Define a function to get the model's response
|
8 |
def get_response(context, question):
|