changxin commited on
Commit
c451602
1 Parent(s): 3042809

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -1,11 +1,14 @@
1
  import gradio as gr
 
2
  def fx(x:str):
3
- return '欢迎浏览:'+x
 
 
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="输出"),_js='''<script language=\"javascript\">alert('充值成功,祝学习创业愉快!');</script>''')
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