Delete app.py
Browse files
app.py
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import torch
|
3 |
-
import os
|
4 |
-
import sys
|
5 |
-
|
6 |
-
# Force CPU usage if needed
|
7 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
8 |
-
print(f"Using device: {device}")
|
9 |
-
|
10 |
-
# More details about the environment
|
11 |
-
print(f"Gradio version: {gr.__version__}")
|
12 |
-
print(f"Python version: {sys.version}")
|
13 |
-
|
14 |
-
# Hugging Face token - çevre değişkeninden
|
15 |
-
hf_token = os.environ.get("HUGGINGFACE_TOKEN")
|
16 |
-
if hf_token:
|
17 |
-
print("Found HUGGINGFACE_TOKEN in environment variables")
|
18 |
-
else:
|
19 |
-
print("HUGGINGFACE_TOKEN not found in environment variables")
|
20 |
-
|
21 |
-
# Basit, orijinal kodlara en yakın versiyonu kullanarak modeli yükle
|
22 |
-
try:
|
23 |
-
# En basit haliyle Gradio modeli yükle
|
24 |
-
print("Loading 3D render style model...")
|
25 |
-
interface = gr.load("goofyai/3d_render_style_xl", src="spaces")
|
26 |
-
|
27 |
-
# Arayüzü başlat
|
28 |
-
print("Model loaded successfully, launching interface...")
|
29 |
-
interface.launch(
|
30 |
-
share=False,
|
31 |
-
server_name="0.0.0.0",
|
32 |
-
server_port=7860,
|
33 |
-
show_error=True
|
34 |
-
)
|
35 |
-
except Exception as e:
|
36 |
-
print(f"Error loading or launching model: {str(e)}")
|
37 |
-
|
38 |
-
# Hata durumunda basit bir yedek arayüz oluştur
|
39 |
-
try:
|
40 |
-
print("Creating a basic fallback interface...")
|
41 |
-
|
42 |
-
def basic_render(prompt):
|
43 |
-
return "Model yüklenemedi. Lütfen HuggingFace kimlik bilgilerinizi kontrol edin."
|
44 |
-
|
45 |
-
backup_interface = gr.Interface(
|
46 |
-
fn=basic_render,
|
47 |
-
inputs=gr.Textbox(label="Input", placeholder="Enter a prompt for 3D rendering"),
|
48 |
-
outputs=gr.Textbox(label="Output"),
|
49 |
-
title="3D Render Style XL (Fallback Mode)",
|
50 |
-
description="Model currently unavailable. Please check your HuggingFace credentials."
|
51 |
-
)
|
52 |
-
|
53 |
-
backup_interface.launch(
|
54 |
-
share=False,
|
55 |
-
server_name="0.0.0.0",
|
56 |
-
server_port=7860,
|
57 |
-
show_error=True
|
58 |
-
)
|
59 |
-
except Exception as e:
|
60 |
-
print(f"Error creating fallback interface: {str(e)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|