Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fix #45

Merged
merged 1 commit into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nexa/cli/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ def main():
image_group = run_parser.add_argument_group('Image generation options')
image_group.add_argument("-i2i", "--img2img", action="store_true", help="Whether to run image-to-image generation")
image_group.add_argument("-ns", "--num_inference_steps", type=int, help="Number of inference steps")
image_group.add_argument("-np", "--num_images_per_prompt", type=int, help="Number of images to generate per prompt")
image_group.add_argument("-np", "--num_images_per_prompt", type=int, deafult=1, help="Number of images to generate per prompt")
image_group.add_argument("-H", "--height", type=int, help="Height of the output image")
image_group.add_argument("-W", "--width", type=int, help="Width of the output image")
image_group.add_argument("-g", "--guidance_scale", type=float, help="Guidance scale for diffusion")
image_group.add_argument("-o", "--output", type=str, help="Output path for the generated image")
image_group.add_argument("-o", "--output", type=str, default="generated_images/image.png", help="Output path for the generated image")
image_group.add_argument("-s", "--random_seed", type=int, help="Random seed for image generation")
image_group.add_argument("--lora_dir", type=str, help="Path to directory containing LoRA files")
image_group.add_argument("--wtype", type=str, help="Weight type (f32, f16, q4_0, q4_1, q5_0, q5_1, q8_0)")
Expand Down
2 changes: 1 addition & 1 deletion nexa/gguf/nexa_inference_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def run_img2img(self):
sample_steps=self.params["num_inference_steps"],
seed=self.params["random_seed"],
control_cond=self.params.get("control_image_path", ""),
control_strength=self.params.get("control_strength", 0.9),
control_strength=self.params.get("control_strength", 0.9),
)

self._save_images(images)
Expand Down
17 changes: 10 additions & 7 deletions nexa/gguf/streamlit/streamlit_image_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ def generate_images(nexa_model: NexaImageInference, prompt: str, negative_prompt
if not os.path.exists(output_dir):
os.makedirs(output_dir)

nexa_model._txt2img(prompt, negative_prompt)

images = []
for file_name in os.listdir(output_dir):
if file_name.endswith(".png"):
image_path = os.path.join(output_dir, file_name)
images.append(Image.open(image_path))
images = nexa_model.txt2img(
prompt=prompt,
negative_prompt=negative_prompt,
cfg_scale=nexa_model.params["guidance_scale"],
width=nexa_model.params["width"],
height=nexa_model.params["height"],
sample_steps=nexa_model.params["num_inference_steps"],
seed=nexa_model.params["random_seed"]
)

return images


Expand Down
2 changes: 1 addition & 1 deletion nexa/gguf/streamlit/streamlit_vlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@st.cache_resource
def load_model(model_path):
local_path, run_type = pull_model(model_path)
nexa_model = NexaVLMInference(model_pat=model_path, local_path=local_path)
nexa_model = NexaVLMInference(model_path=model_path, local_path=local_path)
return nexa_model


Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies = [
"tqdm", # Shared dependencies
"tabulate",
"streamlit",
"streamlit-audiorec",
"python-multipart",
]
classifiers = [
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ PyYAML
requests
setuptools
soundfile
streamlit_audiorec
streamlit-audiorec
transformers
ttstokenizer

Expand Down
Loading