Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,14 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
def fx(x:str):
|
| 3 |
-
|
|
|
|
|
|
|
| 4 |
demo=gr.Blocks()
|
| 5 |
with demo:
|
| 6 |
gr.Dataframe(headers=['项目','数据'],datatype=['str','number'],overflow_row_behaviour='paginate',row_count=4,interactive=True)
|
| 7 |
-
text_input=gr.Textbox(placeholder='请输入测试字符串',label="
|
| 8 |
bb_button=gr.Button("运行")
|
| 9 |
-
bb_button.click(fx, inputs=text_input, outputs=gr.Textbox(label="输出"),
|
| 10 |
demo.launch()
|
| 11 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import hashlib
|
| 3 |
def fx(x:str):
|
| 4 |
+
hash=hashlib.md5()
|
| 5 |
+
hash.update(x.encode(encoding='utf-8'))
|
| 6 |
+
return hash.hexdigest()
|
| 7 |
demo=gr.Blocks()
|
| 8 |
with demo:
|
| 9 |
gr.Dataframe(headers=['项目','数据'],datatype=['str','number'],overflow_row_behaviour='paginate',row_count=4,interactive=True)
|
| 10 |
+
text_input=gr.Textbox(placeholder='请输入测试字符串',label="请输入需要MD5加密的测试内容")
|
| 11 |
bb_button=gr.Button("运行")
|
| 12 |
+
bb_button.click(fx, inputs=text_input, outputs=gr.Textbox(label="输出"),api_name='md5')
|
| 13 |
demo.launch()
|
| 14 |
|