Instructions to use BillyAggarwal/NeuralStyleTransfer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use BillyAggarwal/NeuralStyleTransfer with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://BillyAggarwal/NeuralStyleTransfer") - Notebooks
- Google Colab
- Kaggle
Create gradioapp
Browse files
gradioapp
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from huggingface_hub import InferenceClient
|
| 3 |
+
|
| 4 |
+
client = InferenceClient("BillyAggarwal/NeuralStyleTransfer")
|
| 5 |
+
|
| 6 |
+
def style_transfer(content_image, style_image):
|
| 7 |
+
# send images to Hugging Face model
|
| 8 |
+
result = client.post(
|
| 9 |
+
json={"inputs": {"content": content_image, "style": style_image}}
|
| 10 |
+
)
|
| 11 |
+
return result
|
| 12 |
+
|
| 13 |
+
demo = gr.Interface(
|
| 14 |
+
fn=style_transfer,
|
| 15 |
+
inputs=[gr.Image(), gr.Image()],
|
| 16 |
+
outputs=gr.Image(),
|
| 17 |
+
title="Neural Style Transfer"
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
demo.launch()
|