heegyu commited on
Commit
528d961
·
1 Parent(s): 644bb32

API 쓸 수 있게 수정

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  from transformers import pipeline
 
3
  import torch
4
 
5
 
@@ -17,7 +18,7 @@ def inference(input, instruction, labels):
17
 
18
  print(instruction)
19
  print(output)
20
- return output
21
 
22
 
23
  def greet(content, instruction, labels):
@@ -36,5 +37,5 @@ examples = [
36
  ]
37
  gr.Interface(fn=greet,
38
  inputs=[content, instruction, labels],
39
- outputs=gr.Label(),
40
- examples=examples).launch() # server_name="0.0.0.0",server_port=7860)
 
1
  import gradio as gr
2
  from transformers import pipeline
3
+ import json
4
  import torch
5
 
6
 
 
18
 
19
  print(instruction)
20
  print(output)
21
+ return output, json.dumps(output, ensure_ascii=False)
22
 
23
 
24
  def greet(content, instruction, labels):
 
37
  ]
38
  gr.Interface(fn=greet,
39
  inputs=[content, instruction, labels],
40
+ outputs=[gr.Label(), gr.Text({}, label="json",)],
41
+ examples=examples).launch(server_name="0.0.0.0",server_port=7860, share=True,)