Navyabhat commited on
Commit
687e399
Β·
verified Β·
1 Parent(s): 9fbecf2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -23
app.py CHANGED
@@ -69,35 +69,43 @@ def run(history, text, image, audio_upload, audio_mic):
69
  with gr.Blocks() as demo:
70
  gr.Markdown("## MulitModal Phi2 Model Pretraining and Finetuning from Scratch")
71
 
72
- with gr.Row():
73
- with gr.Column(scale=4):
74
- # Creating a column with a scale of 6
75
- with gr.Box():
76
- with gr.Row():
77
- # Adding image
78
- image = gr.Image(type="filepath", value=None)
79
- # Creating a column with a scale of 2
80
- with gr.Row():
81
- # Add audio
82
- audio_upload = gr.Audio(source="upload", type="filepath")
83
- audio_mic = gr.Audio(
84
- source="microphone", type="filepath", format="mp3"
85
- )
86
-
87
- with gr.Column(scale=8):
88
- with gr.Box():
89
- with gr.Row():
90
- chatbot = gr.Chatbot(
91
- avatar_images=("πŸ§‘", "πŸ€–"),
92
- height=560,
93
- )
94
 
95
  with gr.Row():
96
  # Adding a Textbox with a placeholder "write prompt"
97
  prompt = gr.Textbox(
98
  placeholder="Ask anything", lines=2, label="Query", value=None, scale = 4
99
  )
100
-
 
 
 
 
 
 
 
 
101
  with gr.Row():
102
  # Adding a Button
103
  submit = gr.Button(value = "Submit", variant="success")
 
69
  with gr.Blocks() as demo:
70
  gr.Markdown("## MulitModal Phi2 Model Pretraining and Finetuning from Scratch")
71
 
72
+ # with gr.Row():
73
+ # with gr.Column(scale=4):
74
+ # # Creating a column with a scale of 6
75
+ # with gr.Box():
76
+ # with gr.Row():
77
+ # # Adding image
78
+ # image = gr.Image(type="filepath", value=None)
79
+ # # Creating a column with a scale of 2
80
+ # with gr.Row():
81
+ # # Add audio
82
+ # audio_upload = gr.Audio(source="upload", type="filepath")
83
+ # audio_mic = gr.Audio(
84
+ # source="microphone", type="filepath", format="mp3"
85
+ # )
86
+
87
+ # with gr.Column(scale=8):
88
+ with gr.Box():
89
+ with gr.Row():
90
+ chatbot = gr.Chatbot(
91
+ avatar_images=("πŸ§‘", "πŸ€–"),
92
+ height=560,
93
+ )
94
 
95
  with gr.Row():
96
  # Adding a Textbox with a placeholder "write prompt"
97
  prompt = gr.Textbox(
98
  placeholder="Ask anything", lines=2, label="Query", value=None, scale = 4
99
  )
100
+
101
+ upload_btn = gr.UploadButton("πŸ“", file_types=["image", "audio"])
102
+ if upload_btn is not None and len(upload_btn) > 0:
103
+ file_path = upload_btn[0].name
104
+ image = gr.Image(file_path, type="filepath")
105
+ audio_upload = gr.Audio(file_path, source="upload", type="filepath")
106
+ audio_mic = gr.Audio(
107
+ source="microphone", type="filepath", format="mp3"
108
+ )
109
  with gr.Row():
110
  # Adding a Button
111
  submit = gr.Button(value = "Submit", variant="success")