Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import pandas as pd
|
3 |
+
from ast import literal_eval
|
4 |
+
import joblib
|
5 |
+
|
6 |
+
from cdqa.utils.converters import pdf_converter
|
7 |
+
from cdqa.pipeline import QAPipeline
|
8 |
+
from cdqa.utils.download import download_model #download a pre-trained model
|
9 |
+
|
10 |
+
import gradio as gr
|
11 |
+
|
12 |
+
cdqa_pipeline=joblib.load('aditi2222/new_model') #fitted pipleine
|
13 |
+
|
14 |
+
def generate_answers(query):
|
15 |
+
prediction = cdqa_pipeline.predict(query, 3) #provides top three responses
|
16 |
+
return prediction
|
17 |
+
|
18 |
+
iface = gr.Interface(fn=generate_answers, inputs=[gr.inputs.Textbox(lines=30)],outputs=["query"])
|
19 |
+
iface.launch(inline=False, share=True)
|
20 |
+
|
21 |
+
|
22 |
+
|