Triyono2026 commited on
Commit
1d8bcd5
·
verified ·
1 Parent(s): b4cc683

Delete src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +0 -67
src/streamlit_app.py DELETED
@@ -1,67 +0,0 @@
1
- import streamlit as st
2
- from huggingface_hub import InferenceClient
3
- import os
4
-
5
- # Konfigurasi Halaman
6
- st.set_page_config(page_title="AI Video Scene Architect", page_icon="🎬", layout="wide")
7
-
8
- st.title("🎬 AI Video Scene Architect")
9
-
10
- # Ambil token dari Secrets (HF_TOKEN)
11
- hf_token = os.environ.get("HF_TOKEN")
12
-
13
- with st.sidebar:
14
- st.header("⚙️ Pengaturan")
15
- if not hf_token:
16
- hf_token = st.text_input("Masukkan Hugging Face Token", type="password")
17
- st.caption("Dapatkan di: huggingface.co/settings/tokens")
18
-
19
- num_scenes = st.slider("Jumlah Scene", 1, 20, 5)
20
-
21
- aspect_ratio = st.selectbox(
22
- "Ukuran Video (Aspect Ratio)",
23
- ["16:9", "9:16", "2:3", "4:5"]
24
- )
25
-
26
- style = st.selectbox("Gaya Visual", ["Cinematic", "Realistic Photography", "Anime Style", "3D Animation"])
27
-
28
- # Input User
29
- col1, col2 = st.columns(2)
30
- with col1:
31
- idea = st.text_area("Ide Utama Video", placeholder="Contoh: Astronot memasak di bulan...", height=120)
32
- with col2:
33
- details = st.text_area("Detail Visual", placeholder="Pencahayaan dramatis, warna cerah...", height=120)
34
-
35
- if st.button("🚀 Generate Sequence Prompts"):
36
- if not hf_token:
37
- st.error("❌ Token tidak ditemukan! Isi di sidebar atau Settings > Secrets.")
38
- elif not idea:
39
- st.warning("⚠️ Silakan tulis ide video Anda.")
40
- else:
41
- with st.spinner("Menghubungi AI melalui Router Baru..."):
42
- try:
43
- # Inisialisasi Client (Otomatis menangani routing & error 410)
44
- client = InferenceClient(
45
- model="mistralai/Mistral-7B-Instruct-v0.3",
46
- token=hf_token
47
- )
48
-
49
- # Format Prompt
50
- system_instruction = f"Create {num_scenes} sequential video prompts for: {idea}. Details: {details}. Style: {style}. Ratio: {aspect_ratio}. Duration: 5s per scene. Format: Scene [X] (5s): [Description]"
51
-
52
- # Memanggil AI
53
- response = ""
54
- for message in client.chat_completion(
55
- messages=[{"role": "user", "content": system_instruction}],
56
- max_tokens=2000,
57
- stream=True,
58
- ):
59
- response += message.choices[0].delta.content
60
-
61
- st.success("✅ Rangkaian Scene Berhasil Dibuat!")
62
- st.markdown("---")
63
- st.write(response)
64
-
65
- except Exception as e:
66
- st.error(f"❌ Terjadi kesalahan: {e}")
67
- st.info("Jika error 503, tunggu 1 menit lalu klik Generate lagi karena model sedang 'warming up'.")