Update app.py
Browse files
app.py
CHANGED
@@ -104,7 +104,51 @@ def video_to_text(input):
|
|
104 |
output = video_model(frames)
|
105 |
return output[0]["label"]
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
|
|
|
108 |
# Create a title for the app
|
109 |
st.title("My Generic AI App")
|
110 |
|
|
|
104 |
output = video_model(frames)
|
105 |
return output[0]["label"]
|
106 |
|
107 |
+
#Output switches
|
108 |
+
|
109 |
+
# Define the process_input function
|
110 |
+
def process_input(user_input, input_format, output_format):
|
111 |
+
|
112 |
+
# Use a switch case to call the appropriate function based on the input and output formats
|
113 |
+
if input_format == "Text" and output_format == "Text":
|
114 |
+
output = text_to_text(user_input)
|
115 |
+
elif input_format == "Text" and output_format == "Audio":
|
116 |
+
output = text_to_audio(user_input)
|
117 |
+
elif input_format == "Text" and output_format == "Image":
|
118 |
+
output = text_to_image(user_input)
|
119 |
+
elif input_format == "Text" and output_format == "Video":
|
120 |
+
output = text_to_video(user_input)
|
121 |
+
elif input_format == "Audio" and output_format == "Text":
|
122 |
+
output = audio_to_text(user_input)
|
123 |
+
elif input_format == "Audio" and output_format == "Audio":
|
124 |
+
output = audio_to_audio(user_input)
|
125 |
+
elif input_format == "Audio" and output_format == "Image":
|
126 |
+
output = audio_to_image(user_input)
|
127 |
+
elif input_format == "Audio" and output_format == "Video":
|
128 |
+
output = audio_to_video(user_input)
|
129 |
+
elif input_format == "Image" and output_format == "Text":
|
130 |
+
output = image_to_text(user_input)
|
131 |
+
elif input_format == "Image" and output_format == "Audio":
|
132 |
+
output = image_to_audio(user_input)
|
133 |
+
elif input_format == "Image" and output_format == "Image":
|
134 |
+
output = image_to_image(user_input)
|
135 |
+
elif input_format == "Image" and output_format == "Video":
|
136 |
+
output = image_to_video(user_input)
|
137 |
+
elif input_format == "Video" and output_format == "Text":
|
138 |
+
output = video_to_text(user_input)
|
139 |
+
elif input_format == "Video" and output_format == "Audio":
|
140 |
+
output = video_to_audio(user_input)
|
141 |
+
elif input_format == "Video" and output_format == "Image":
|
142 |
+
output = video_to_image(user_input)
|
143 |
+
elif input_format == "Video" and output_format == "Video":
|
144 |
+
output = video_to_video(user_input)
|
145 |
+
else:
|
146 |
+
output = "Invalid input or output format"
|
147 |
+
|
148 |
+
# Return the output data as a gradio output object
|
149 |
+
return output
|
150 |
|
151 |
+
|
152 |
# Create a title for the app
|
153 |
st.title("My Generic AI App")
|
154 |
|