Spaces:
Build error
Build error
| 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) |