TheStinger commited on
Commit
eb0bc41
1 Parent(s): fe2797a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -22
app.py CHANGED
@@ -1,24 +1,42 @@
1
  import gradio as gr
2
- from PIL import Image
3
-
4
- def get_image_info(image_path):
5
- # Apri l'immagine
6
- with Image.open(image_path) as img:
7
- # Ottieni le informazioni dell'immagine
8
- format = img.format
9
- mode = img.mode
10
- size = img.size
11
- info = img.info
12
-
13
- # Crea una stringa con le informazioni dell'immagine
14
- info_str = f"Formato: {format}\n"
15
- info_str += f"Modalità: {mode}\n"
16
- info_str += f"Dimensioni: {size}\n"
17
- info_str += "Informazioni:\n"
18
- for key, value in info.items():
19
- info_str += f" {key}: {value}\n"
20
-
21
- return info_str
22
-
23
- iface = gr.Interface(fn=get_image_info, inputs="file", outputs="text")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  iface.launch()
 
1
  import gradio as gr
2
+
3
+ # Definisci le tue quattro applicazioni qui
4
+ def app1(input):
5
+ # Codice per l'applicazione 1
6
+ pass
7
+
8
+ def app2(input):
9
+ # Codice per l'applicazione 2
10
+ pass
11
+
12
+ def app3(input):
13
+ # Codice per l'applicazione 3
14
+ pass
15
+
16
+ def app4(input):
17
+ # Codice per l'applicazione 4
18
+ pass
19
+
20
+ # Crea un'interfaccia per ogni applicazione
21
+ iface1 = gr.Interface(fn=app1, inputs="textbox", outputs="textbox")
22
+ iface2 = gr.Interface(fn=app2, inputs="textbox", outputs="textbox")
23
+ iface3 = gr.Interface(fn=app3, inputs="textbox", outputs="textbox")
24
+ iface4 = gr.Interface(fn=app4, inputs="textbox", outputs="textbox")
25
+
26
+ # Crea una funzione per gestire il cambio di applicazione
27
+ def switch_app(input, choice):
28
+ if choice == 'Applicazione 1':
29
+ return iface1.process(input)
30
+ elif choice == 'Applicazione 2':
31
+ return iface2.process(input)
32
+ elif choice == 'Applicazione 3':
33
+ return iface3.process(input)
34
+ elif choice == 'Applicazione 4':
35
+ return iface4.process(input)
36
+
37
+ # Crea l'interfaccia principale con un selettore per l'applicazione
38
+ iface = gr.Interface(fn=switch_app,
39
+ inputs=["textbox", gr.inputs.Radio(['Applicazione 1', 'Applicazione 2', 'Applicazione 3', 'Applicazione 4'])],
40
+ outputs="textbox")
41
+
42
  iface.launch()