changxin commited on
Commit
1d0ae93
·
1 Parent(s): 5632065

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -47,6 +47,14 @@ def fx5():
47
  def fx6():
48
  return ht_text
49
 
 
 
 
 
 
 
 
 
50
  with demo:
51
  gr.Markdown(
52
  """
@@ -76,6 +84,10 @@ with demo:
76
  with gr.TabItem("Excel365测试"):
77
  lk_button = gr.Button("Excel调用>>")
78
  lk_output=gr.HTML(label="在线版演示",show_label=True)
 
 
 
 
79
 
80
  tj_button.click(fx1, inputs=text_input, outputs=text_output)
81
  cs_button.click(fx2, inputs=val_input, outputs=json_output)
@@ -83,5 +95,6 @@ with demo:
83
  tts_button.click(fx4, inputs=TS_input, outputs=audio_output)
84
  pva_button.click(fx5, inputs=[],outputs=pva_output)
85
  lk_button.click(fx6, inputs=[],outputs=lk_output)
 
86
 
87
  demo.launch()
 
47
  def fx6():
48
  return ht_text
49
 
50
+ def FX7(input_path,input_path2):
51
+ input_img = load_img(input_path)
52
+ input_img2 = load_img(input_path2)
53
+ hub_model = hub.load('https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2')
54
+ stylized_image = hub_model(tf.constant(input_img), tf.constant(input_img2))[0]
55
+ pre_img = tensor_to_image(stylized_image)
56
+ return pre_img
57
+
58
  with demo:
59
  gr.Markdown(
60
  """
 
84
  with gr.TabItem("Excel365测试"):
85
  lk_button = gr.Button("Excel调用>>")
86
  lk_output=gr.HTML(label="在线版演示",show_label=True)
87
+ with gr.TabItem("风格迁移"):
88
+ qy_input=[gr.Image(label="待转换图片",type="filepath"),gr.Image(label="风格图片",type="filepath")]
89
+ qy_output=gr.Image(type="auto", label="输出")
90
+ qy_button = gr.Button("开始迁移>>")
91
 
92
  tj_button.click(fx1, inputs=text_input, outputs=text_output)
93
  cs_button.click(fx2, inputs=val_input, outputs=json_output)
 
95
  tts_button.click(fx4, inputs=TS_input, outputs=audio_output)
96
  pva_button.click(fx5, inputs=[],outputs=pva_output)
97
  lk_button.click(fx6, inputs=[],outputs=lk_output)
98
+ qy_button.click(fx7,examples=[[demo_path,demo_path2],],inputs=qy_input,outputs=qy_output,theme="dark-seafoam")
99
 
100
  demo.launch()