Spaces:
Build error
Build error
File size: 515 Bytes
a0e48af |
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 |
import gradio as gr
import re
title="Information Extraction"
def match(pattern,text):
match_text=re.findall(pattern,text)
if match_text:
return match_text[0]
def extractInformation(text):
age=match("age (\d)",text)
name=match('Born(.*)\n',text)
return{
'Age':int(age),
'Full Name':name.strip()
}
def infoExtract(input):
out=extractInformation(input)
return out
interface=gr.Interface(fn=infoExtract,inputs='text',outputs='text',title=title)
interface.launch(inline=False) |