kikopubisher commited on
Commit
8838600
·
verified ·
1 Parent(s): 619c5e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -12
app.py CHANGED
@@ -1,23 +1,23 @@
1
  import streamlit as st
2
  from PIL import Image
3
  import torch
4
- from diffusers import DiffusionPipeline
5
- import io
6
  import numpy as np
 
7
 
8
  # إعداد الصفحة
9
- st.set_page_config(page_title="InstantMesh - 3D Mesh Generation", page_icon="🖼️")
10
 
11
  # عنوان الصفحة
12
- st.title("InstantMesh - 3D Mesh Generation from Image")
13
 
14
  # تعليمات
15
- st.write("Upload an image to generate a 3D mesh. InstantMesh creates detailed 3D models within seconds.")
16
 
17
  # تحميل النموذج
18
  @st.cache_resource
19
  def load_model():
20
- model_id = "TencentARC/InstantMesh"
21
  pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda")
22
  return pipe
23
 
@@ -36,14 +36,12 @@ if uploaded_image is not None:
36
 
37
  # توليد الشبكة ثلاثية الأبعاد
38
  with st.spinner("Generating 3D mesh..."):
39
- mesh = pipe(image_tensor).images
40
 
41
  st.success("3D mesh generated successfully!")
42
 
43
  # عرض النتيجة
44
  st.write("### 3D Mesh Preview")
45
- # حاوية لعرض الـ 3D Mesh
46
- # ملاحظة: قد تحتاج إلى تكوين طريقة لعرض أو تحميل النموذج ثلاثي الأبعاد بشكل صحيح.
47
  st.image(mesh[0], caption="Generated 3D Mesh", use_column_width=True)
48
 
49
  # تنزيل النموذج
@@ -53,6 +51,5 @@ if uploaded_image is not None:
53
 
54
  # تقديم بعض المعلومات حول النموذج
55
  st.write("""
56
- ### About InstantMesh:
57
- InstantMesh is a feed-forward framework for instant 3D mesh generation from a single image. It uses a combination of a multiview diffusion model and a sparse-view reconstruction model based on the LRM architecture to create diverse 3D assets quickly. The framework integrates a differentiable iso-surface extraction module to optimize the mesh representation, making it highly efficient and accurate.
58
- """)
 
1
  import streamlit as st
2
  from PIL import Image
3
  import torch
4
+ from diffusers import DiffusionPipeline # تأكد من استخدام مكتبة متوافقة مع النموذج الجديد
 
5
  import numpy as np
6
+ import io
7
 
8
  # إعداد الصفحة
9
+ st.set_page_config(page_title="3D Mesh Generation", page_icon="🖼️")
10
 
11
  # عنوان الصفحة
12
+ st.title("3D Mesh Generation from Image")
13
 
14
  # تعليمات
15
+ st.write("Upload an image to generate a 3D mesh.")
16
 
17
  # تحميل النموذج
18
  @st.cache_resource
19
  def load_model():
20
+ model_id = "your_new_model_id_here" # استبدل بـ ID النموذج الجديد
21
  pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda")
22
  return pipe
23
 
 
36
 
37
  # توليد الشبكة ثلاثية الأبعاد
38
  with st.spinner("Generating 3D mesh..."):
39
+ mesh = pipe(image_tensor).images # تأكد من أن هذا هو الاستخدام الصحيح للنموذج
40
 
41
  st.success("3D mesh generated successfully!")
42
 
43
  # عرض النتيجة
44
  st.write("### 3D Mesh Preview")
 
 
45
  st.image(mesh[0], caption="Generated 3D Mesh", use_column_width=True)
46
 
47
  # تنزيل النموذج
 
51
 
52
  # تقديم بعض المعلومات حول النموذج
53
  st.write("""
54
+ ### About the Model:
55
+ This model generates 3D meshes from single images