Spaces:
Runtime error
Runtime error
Commit History
-
Update app.py
Verified signaturee01d937 -
Create app.py
Verified signatureimport torch import gradio as gr # Use a pipeline as a high-level helper from transformers import pipeline #modal_path = ("../Models/models--deepset--roberta-base-squad2/snapshots/cbf50ba81465d4d8676b8bab348e31835147541b") #question_answer = pipeline("question-answering", model=modal_path) question_answer = pipeline("question-answering", model="deepset/roberta-base-squad2") def read_file_content(file_path): try: with open(file_path, 'r') as file_obj: content = file_obj.read() if content is not None: return content except Exception as e: print(f"An error occurred while reading the file: {e}") return None def get_answer_from_context(file, question): context = read_file_content(file) get_answer = question_answer(question=question, context=context) return get_answer['answer'] gr.close_all() demo = gr.Interface(fn=get_answer_from_context, inputs= [gr.File(label='Upload Docum…abfd574 -
Create requirements.txt
Verified signature8a6a89a -
initial commit
Verified signature7f0b53a