Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import math | |
| from langchain import PromptTemplate, HuggingFaceHub, LLMChain | |
| import os | |
| llm=HuggingFaceHub(repo_id="google/flan-t5-xxl") | |
| template = """ | |
| I want you to convert a number as word to an integer. | |
| Convert {number}? | |
| """ | |
| prompt = PromptTemplate(template=template, input_variables=["number"]) | |
| chain = LLMChain(llm=llm, prompt=prompt) | |
| def answer(number): | |
| out=chain.run(number) | |
| out1=int(out) | |
| out2=math.factorial(out1) | |
| return out2 | |
| demo = gr.Interface(fn=answer, inputs='text',outputs='text',examples= [['Eight']]) | |
| demo.launch() |