Spaces:
Build error
Build error
Download app.py from FefeCats/Meu_android: direct link, hf CLI and curl.
- Browser
- Download file 2.06 kB
-
https://huggingface.co/spaces/FefeCats/Meu_android/resolve/main/app.py
- Command line
-
hf download hf://spaces/FefeCats/Meu_android/app.py
-
curl -L -o app.py https://huggingface.co/spaces/FefeCats/Meu_android/resolve/main/app.py
2.06 kB
| import os | |
| import subprocess | |
| import gradio as gr | |
| # Função para executar comandos no terminal Linux | |
| def executar_comando(comando): | |
| if not comando or not comando.strip(): | |
| return "Digite um comando para executar." | |
| try: | |
| resultado = subprocess.check_output( | |
| comando, | |
| shell=True, | |
| stderr=subprocess.STDOUT, | |
| text=True, | |
| timeout=120 | |
| ) | |
| return resultado | |
| except subprocess.CalledProcessError as e: | |
| return f"Erro na execução:\n{e.output}" | |
| except Exception as e: | |
| return f"Erro: {str(e)}" | |
| # Interface visual do Linux | |
| with gr.Blocks(title="Meu Linux na Nuvem") as demo: | |
| gr.Markdown("# 🚀 Meu Ambiente Linux na Nuvem") | |
| gr.Markdown("Servidor ativo com **16 GB de RAM**.") | |
| with gr.Tab("💻 Terminal de Comandos"): | |
| gr.Markdown("Digite qualquer comando Linux abaixo e clique em **Executar**:") | |
| comando_input = gr.Textbox( | |
| placeholder="Exemplo: free -m ou uname -a", | |
| label="Comando Linux", | |
| lines=2 | |
| ) | |
| btn_executar = gr.Button("Executar Comando", variant="primary") | |
| saida_terminal = gr.Code(label="Resultado do Terminal", language="shell") | |
| btn_executar.click( | |
| fn=executar_comando, | |
| inputs=comando_input, | |
| outputs=saida_terminal | |
| ) | |
| with gr.Tab("📱 Comandos para Android"): | |
| gr.Markdown(""" | |
| ### Passo a passo para rodar o Android: | |
| **1. Baixar a ISO do Android:** | |
| ```bash | |
| wget -O android.iso "https://downloads.sourceforge.net/project/android-x86/Release%208.1-r6/android-x86-8.1-r6.iso" | |
| ``` | |
| **2. Criar o disco virtual:** | |
| ```bash | |
| qemu-img create -f qcow2 android.img 8G | |
| ``` | |
| **3. Iniciar o Android no QEMU:** | |
| ```bash | |
| qemu-system-x86_64 -m 4096 -smp 2 -cdrom android.iso -hda android.img & | |
| ``` | |
| """) | |
| if __name__ == "__main__": | |
| demo.queue().launch(server_name="0.0.0.0", server_port=7860) |