Spaces:
Sleeping
Sleeping
import gradio as gr | |
import re | |
def fetch_numbers(text): | |
numbers=re.findall(r'-?\d+\.?\d*', text) | |
return [float(num) for num in numbers] | |
inputs=gr.Textbox(label='從文本中擷取數字', | |
lines=7, | |
placeholder='輸入文數字') | |
demo=gr.Interface(fn=fetch_numbers, | |
inputs=inputs, | |
outputs="textbox") | |
if __name__ == "__main__": | |
demo.launch() | |