File size: 555 Bytes
d38127c
 
 
 
 
 
 
 
 
74e7f0d
d38127c
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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()