Joseph Pollack commited on
Commit
483aa90
·
unverified ·
1 Parent(s): 6b4a0c8

improves demo interface

Browse files
Files changed (1) hide show
  1. app.py +36 -59
app.py CHANGED
@@ -8,6 +8,26 @@ from typing import List, Dict, Any
8
  import logging
9
  import spaces
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  # Configure logging
12
  logging.basicConfig(level=logging.INFO)
13
  logger = logging.getLogger(__name__)
@@ -395,8 +415,8 @@ def create_demo():
395
  """Create the Gradio demo interface using Blocks"""
396
 
397
  with gr.Blocks(
398
- title="L-Operator: Android Device Control Demo",
399
- theme=gr.themes.Soft(),
400
  css="""
401
  .gradio-container {
402
  max-width: 1200px !important;
@@ -412,39 +432,15 @@ def create_demo():
412
  }
413
  """
414
  ) as demo:
 
 
415
 
416
- gr.Markdown("""
417
- # 🤖 L-Operator: Android Device Control Demo
418
-
419
- **Lightweight Multimodal Android Device Control Agent**
420
-
421
- This demo showcases the L-Operator model, a fine-tuned multimodal AI agent based on LiquidAI's LFM2-VL-1.6B model,
422
- optimized for Android device control through visual understanding and action generation.
423
-
424
- ## 🚀 How to Use
425
-
426
- 1. **Upload Screenshot**: Upload an Android device screenshot
427
- 2. **Describe Goal**: Enter what you want to accomplish
428
- 3. **Get Actions**: The model will generate JSON actions for Android device control
429
-
430
- ## 📋 Expected Output Format
431
-
432
- The model generates JSON actions in the following format:
433
- ```json
434
- {
435
- "action_type": "click",
436
- "x": 540,
437
- "y": 1200,
438
- "text": "Settings",
439
- "app_name": "com.android.settings",
440
- "confidence": 0.92
441
- }
442
- ```
443
-
444
- **🎯 Visual Feedback**: When the model returns coordinates (x, y), an annotated screenshot will be displayed showing the exact click location with a red bounding box and crosshair.
445
-
446
- ---
447
- """)
448
 
449
  with gr.Row():
450
  with gr.Column(scale=1):
@@ -564,25 +560,6 @@ def create_demo():
564
 
565
  gr.Markdown("""
566
  ---
567
-
568
- ## 📊 Model Details
569
-
570
- | Property | Value |
571
- |----------|-------|
572
- | **Base Model** | LiquidAI/LFM2-VL-1.6B |
573
- | **Architecture** | LFM2-VL (1.6B parameters) |
574
- | **Fine-tuning** | LoRA (Low-Rank Adaptation) |
575
- | **Training Data** | Android control episodes with screenshots and actions |
576
-
577
- ## 🎯 Use Cases
578
-
579
- - **Mobile App Testing**: Automated UI testing for Android applications
580
- - **Accessibility Applications**: Voice-controlled device navigation
581
- - **Remote Support**: Remote device troubleshooting
582
- - **Development Workflows**: UI/UX testing automation
583
-
584
- ---
585
-
586
  **Made with ❤️ by Tonic** | [Model on Hugging Face](https://huggingface.co/Tonic/l-android-control)
587
  """)
588
 
@@ -596,14 +573,14 @@ if __name__ == "__main__":
596
 
597
  logger.info("Launching Gradio server...")
598
  demo.launch(
599
- server_name="0.0.0.0",
600
- server_port=7860,
601
- share=False,
602
- debug=False, # Disable debug to reduce startup time
603
  show_error=True,
604
  ssr_mode=False,
605
- max_threads=2, # Limit threads to prevent resource exhaustion
606
- quiet=True # Reduce startup logging noise
607
  )
608
  except Exception as e:
609
  logger.error(f"Failed to launch Gradio app: {str(e)}")
 
8
  import logging
9
  import spaces
10
 
11
+ title = """L-Operator: Android📲Device Control Demo"""
12
+ description = """
13
+ # 🤖 L-Operator: Android Device Control Demo
14
+
15
+ **Lightweight Multimodal Android Device Control Agent**
16
+
17
+ This demo showcases the L-Operator model, a fine-tuned multimodal AI agent based on LiquidAI's LFM2-VL-1.6B model,
18
+ optimized for Android device control through visual understanding and action generation.
19
+
20
+ ## 🚀 How to Use
21
+
22
+ 1. **Upload Screenshot**: Upload an Android device screenshot
23
+ 2. **Describe Goal**: Enter what you want to accomplish
24
+ 3. **Get Actions**: The model will generate JSON actions for Android device control
25
+ """
26
+ joinus = """
27
+ ## Join us :
28
+ 🌟TeamTonic🌟 is always making cool demos! Join our active builder's 🛠️community 👻 [![Join us on Discord](https://img.shields.io/discord/1109943800132010065?label=Discord&logo=discord&style=flat-square)](https://discord.gg/qdfnvSPcqP) On 🤗Huggingface:[MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Tonic-AI](https://github.com/tonic-ai) & contribute to🌟 [MultiTonic](https://github.com/MultiTonic)🤗Big thanks to Yuvi Sharma and all the folks at huggingface for the community grant 🤗
29
+ """
30
+
31
  # Configure logging
32
  logging.basicConfig(level=logging.INFO)
33
  logger = logging.getLogger(__name__)
 
415
  """Create the Gradio demo interface using Blocks"""
416
 
417
  with gr.Blocks(
418
+ title=title,
419
+ theme=gr.themes.Monochrome(),
420
  css="""
421
  .gradio-container {
422
  max-width: 1200px !important;
 
432
  }
433
  """
434
  ) as demo:
435
+ # Header section
436
+ gr.Markdown(title)
437
 
438
+ # Info section
439
+ with gr.Row():
440
+ with gr.Column(scale=1):
441
+ gr.Markdown(description)
442
+ with gr.Column(scale=1):
443
+ gr.Markdown(joinus)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
 
445
  with gr.Row():
446
  with gr.Column(scale=1):
 
560
 
561
  gr.Markdown("""
562
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
563
  **Made with ❤️ by Tonic** | [Model on Hugging Face](https://huggingface.co/Tonic/l-android-control)
564
  """)
565
 
 
573
 
574
  logger.info("Launching Gradio server...")
575
  demo.launch(
576
+ # server_name="0.0.0.0",
577
+ # server_port=7860,
578
+ # share=False,
579
+ # debug=False, # Disable debug to reduce startup time
580
  show_error=True,
581
  ssr_mode=False,
582
+ # max_threads=2, # Limit threads to prevent resource exhaustion
583
+ # quiet=True # Reduce startup logging noise
584
  )
585
  except Exception as e:
586
  logger.error(f"Failed to launch Gradio app: {str(e)}")