kivilaid commited on
Commit
c78d2b1
·
1 Parent(s): 68474f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -26
app.py CHANGED
@@ -1,6 +1,4 @@
1
  import gradio as gr
2
- import requests
3
- import json
4
 
5
  # Function for the Hello World interface
6
  hello_world = gr.Interface(lambda name: "Hello " + name, "text", "text")
@@ -15,29 +13,8 @@ def check_input(input_string):
15
 
16
  should_we_translate = gr.Interface(check_input, "text", "text")
17
 
18
- # Function for the Statistics interface
19
- def statistics():
20
- url = "https://api.locize.app/4a48f53b-4f59-4179-ade9-25766306c8ed/latest/en/translation"
21
- try:
22
- data = fetch_json(url)
23
- stats = [
24
- f"1. Total number of keys: {total_keys(data)}",
25
- f"2. Total number of keys where value is the same: {keys_value_same(data)}",
26
- f"3. Total number of keys where value is not the same as key: {keys_value_not_same(data)}",
27
- f"4. Total number keys that do not contain any word or words: {keys_without_words(data)}",
28
- f"5. Total number of keys that contain only a number: {keys_only_numbers(data)}",
29
- f"6. Total number of keys that contain only a character: {keys_only_characters(data)}",
30
- f"7. Total number of keys that contain only a single word: {keys_single_word(data)}",
31
- f"8. Total number of keys that contain only words: {keys_only_words(data)}"
32
- ]
33
- return "\n".join(stats)
34
- except Exception as e:
35
- return str(e)
36
-
37
- statistics_interface = gr.Interface(statistics, inputs=None, outputs="text")
38
-
39
- # Creating a Tabbed Interface with the updated names
40
- demo = gr.TabbedInterface([hello_world, should_we_translate, statistics_interface], ["Hello World", "Should we translate?", "Statistics"])
41
 
42
  if __name__ == "__main__":
43
- demo.launch()
 
1
  import gradio as gr
 
 
2
 
3
  # Function for the Hello World interface
4
  hello_world = gr.Interface(lambda name: "Hello " + name, "text", "text")
 
13
 
14
  should_we_translate = gr.Interface(check_input, "text", "text")
15
 
16
+ # Creating a Tabbed Interface without the Statistics tab
17
+ demo = gr.TabbedInterface([hello_world, should_we_translate], ["Hello World", "Should we translate?"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  if __name__ == "__main__":
20
+ demo.launch()