fffiloni commited on
Commit
283777a
1 Parent(s): b0c635c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +76 -5
app.py CHANGED
@@ -16,11 +16,82 @@ def infer(audio):
16
 
17
  #portrait_response = requests.get(portrait_link, headers={'Authorization': 'Bearer ' + token})
18
  #print(portrait_response.text)
19
- return audio_response, portrait_link
20
 
21
- inputs = gr.Audio(source="microphone",type="filepath")
22
- outputs = [gr.Audio(), gr.Video()]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
- demo = gr.Interface(fn=infer, inputs=inputs, outputs=outputs)
25
- demo.launch()
26
 
 
16
 
17
  #portrait_response = requests.get(portrait_link, headers={'Authorization': 'Bearer ' + token})
18
  #print(portrait_response.text)
19
+ return portrait_link
20
 
21
+ title = """
22
+ <div style="text-align: center; max-width: 500px; margin: 0 auto;">
23
+ <div
24
+ style="
25
+ display: inline-flex;
26
+ align-items: center;
27
+ gap: 0.8rem;
28
+ font-size: 1.75rem;
29
+ margin-bottom: 10px;
30
+ "
31
+ >
32
+ <h1 style="font-weight: 600; margin-bottom: 7px;">
33
+ GPT Talking Portrait
34
+ </h1>
35
+ </div>
36
+ <p style="margin-bottom: 10px;font-size: 94%;font-weight: 100;line-height: 1.5em;">
37
+ Use Whisper to ask, alive portrait responds !
38
+ </p>
39
+ </div>
40
+ """
41
+
42
+ css = '''
43
+ #col-container, #col-container-2 {max-width: 510px; margin-left: auto; margin-right: auto;}
44
+ a {text-decoration-line: underline; font-weight: 600;}
45
+ div#record_btn > .mt-6 {
46
+ margin-top: 0!important;
47
+ }
48
+ div#record_btn > .mt-6 button {
49
+ width: 100%;
50
+ height: 40px;
51
+ }
52
+ .footer {
53
+ margin-bottom: 45px;
54
+ margin-top: 10px;
55
+ text-align: center;
56
+ border-bottom: 1px solid #e5e5e5;
57
+ }
58
+ .footer>p {
59
+ font-size: .8rem;
60
+ display: inline-block;
61
+ padding: 0 10px;
62
+ transform: translateY(10px);
63
+ background: white;
64
+ }
65
+ .dark .footer {
66
+ border-color: #303030;
67
+ }
68
+ .dark .footer>p {
69
+ background: #0b0f19;
70
+ }
71
+ '''
72
+
73
+ with gr.Blocks(css=css) as demo:
74
+
75
+ with gr.Column(elem_id="col-container"):
76
+
77
+ gr.HTML(title)
78
+
79
+ with gr.Row():
80
+ record_input = gr.Audio(source="microphone",type="filepath", show_label=False,elem_id="record_btn")
81
+
82
+ with gr.Row():
83
+
84
+ send_btn = gr.Button("Send my request !")
85
+
86
+
87
+ with gr.Column(elem_id="col-container-2"):
88
+
89
+ gpt_response = gr.Video()
90
+
91
+
92
+
93
+ send_btn.click(infer, inputs=[record_input], outputs=[gpt_response])
94
+
95
+ demo.queue(max_size=32, concurrency_count=20).launch(debug=True)
96
 
 
 
97