Spaces:
Sleeping
Sleeping
File size: 1,333 Bytes
84e78bb 2e62286 666371e 84e78bb 2e62286 84e78bb 2e62286 84e78bb c05833d 84e78bb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# App.py to launch the app via hugging face
#######################################################################################################
# IMPORT
#######################################################################################################
import pandas as pd
import gradio as gr
# modules
from modules.language_model import TAPAS
##################################################################################
# Function that enables testing
##################################################################################
table_main = pd.read_csv('./data' + '/' + 'gadm41_DEU_1_main').astype(str)
def AskAI(ques, lv, table_main = table_main):
level = int(lv) # Currently placeholder
question = str(ques)
ans = TAPAS(question = question, table_main= table_main)
return(ans)
def AskAI_easy(ques):
Tmain = pd.read_csv('./data' + '/' + 'gadm41_DEU_1_main').astype(str)
blub = str(AskAI(ques,1,Tmain))
return(blub)
#######################################################################################
# Gradio Interface
###############################################################################
desc = 'Example: What is the Bundesland with tyhe biggest Area?'
iface = gr.Interface(fn=AskAI_easy, inputs=['text'], outputs='text', description= desc)
iface.launch() |