Coder Social home page Coder Social logo

demo-face-gan's Introduction

Open in Streamlit

Streamlit Demo: The Controllable GAN Face Generator

This project highlights Streamlit's new st.experimental_memo() and st.experimental_singleton() features with an app that calls on TensorFlow to generate photorealistic faces, using Nvidia's Progressive Growing of GANs and Shaobo Guan's Transparent Latent-space GAN method for tuning the output face's characteristics. For more information, check out the tutorial on Towards Data Science.

The Streamlit app is implemented in only 150 lines of Python and demonstrates the wide new range of objects that can be used safely and efficiently in Streamlit apps.

In-use Animation

How to run this demo

The demo requires Python 3.6 or 3.7 (The version of TensorFlow we use is not supported in Python 3.8+). We suggest creating a new virtual environment, then running:

git clone https://github.com/streamlit/demo-face-gan.git
cd demo-face-gan
poetry install
poetry run streamlit run streamlit_app.py

Model Bias

Playing with the sliders, you will find biases that exist in this model. For example, moving the Smiling slider can turn a face from masculine to feminine or from lighter skin to darker. Apps like these that allow you to visually inspect model inputs help you find these biases so you can address them in your model before it's put into production.

Questions? Comments?

Please ask in the Streamlit community or check out our article.

demo-face-gan's People

Contributors

arnaudmiribel avatar asaini avatar ashzblum avatar dependabot[bot] avatar jrhone avatar kantuni avatar kellyamanda avatar randyzwitch avatar tc87 avatar treuille avatar tvst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

demo-face-gan's Issues

Issue: The app transforms white man into black when smiling parameter is reduced

The webapp is transforming the face of a white man to a black man when the 'Smiling' is reduced to 0 .

This can be considered Racist (where no smiling is being indicated a trait of a Black man) and should be fixed to avoid backlash in future.

To reproduce:

  • Select Young as 60
  • Select Smiling as 90
  • Select Male as 100
  • Now drop Smiling to 0 .

TF already compatible with Python 3.7

Hi, just tried it and works with Python 3.7, so that should not be an issue anymore, that way you can reduce friction to try the demo.

Btw, great work and awesome Streamlit If you can deploy it even better to evangelize.

AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key'

On cloning and running on my local machine, after following each step clearly, I get the following message:


Traceback (most recent call last):
  File "c:\users\raghav khullar\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\raghav khullar\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Raghav Khullar\AppData\Local\Programs\Python\Python37\Scripts\streamlit.exe\__main__.py", line 4, in <module>
  File "c:\users\raghav khullar\appdata\local\programs\python\python37\lib\site-packages\streamlit\__init__.py", line 75, in <module>
    from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
  File "c:\users\raghav khullar\appdata\local\programs\python\python37\lib\site-packages\streamlit\delta_generator.py", line 25, in <module>
    from streamlit.proto import Block_pb2
  File "c:\users\raghav khullar\appdata\local\programs\python\python37\lib\site-packages\streamlit\proto\Block_pb2.py", line 21, in <module>
    create_key=_descriptor._internal_create_key,
AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key'

How can I resolve this?

How to resolve tensorflow version mismatch with Python 3.8

How do I resolve this error?

ERROR: Could not find a version that satisfies the requirement tensorflow==1.15.2 (from -r requirements.txt (line 14)) (from versions: 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.3.0rc0, 2.3.0rc1, 2.3.0rc2, 2.3.0)
ERROR: No matching distribution found for tensorflow==1.15.2 (from -r requirements.txt (line 14))

"open in streamlit" app is broken?

Thanks for providing this cool open-source tool to the community! ๐Ÿ‘

I wanted to try out streamlit without installing it locally so I clicked this badge:

Open in Streamlit

The app started up fine, but if I changed any of the sliders, I just got a missing image icon.

image

Not sure if I have done something wrong or if this is a bug...

ModuleNotFoundError: No module named 'feature_axis'

File "c:\users\asus\appdata\local\programs\python\python37\lib\site-packages\streamlit\ScriptRunner.py", line 319, in _run_script
exec(code, module.dict)
File "C:\Users\asus\PycharmProjects\streamlit_project\demo_face_gan_project.py", line 9, in
import feature_axis

After installing packages manually, it still does not run.

Maybe more packages missing or 3.10 not supported.

Python version

(venv) 08:54:38|C|demo-face-gan> python --version
Python 3.10.0

My requirements.txt
requirements.txt

Error

2022-08-11 08:43:47.223040: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-08-11 08:43:47.223212: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
C:\Users\HaraldEllingsen\demo-face-gan\pg_gan\tfutil.py:179: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if v.shape.ndims is 0:
C:\Users\HaraldEllingsen\demo-face-gan\pg_gan\tfutil.py:181: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif v.shape.ndims is 1:
C:\Users\HaraldEllingsen\demo-face-gan\pg_gan\tfutil_cpu.py:179: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if v.shape.ndims is 0:
C:\Users\HaraldEllingsen\demo-face-gan\pg_gan\tfutil_cpu.py:181: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif v.shape.ndims is 1:
2022-08-11 08:44:55.899 Uncaught app exception
Traceback (most recent call last):
  File "C:\Users\HaraldEllingsen\demo-face-gan\venv\lib\site-packages\streamlit\caching\cache_utils.py", line 126, in get_or_create_cached_value
    return_value = cache.read_value(value_key)
  File "C:\Users\HaraldEllingsen\demo-face-gan\venv\lib\site-packages\streamlit\caching\singleton_decorator.py", line 262, in read_value
    raise CacheKeyNotFoundError()
streamlit.caching.cache_errors.CacheKeyNotFoundError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\HaraldEllingsen\demo-face-gan\venv\lib\site-packages\streamlit\scriptrunner\script_runner.py", line 557, in _run_script
    exec(code, module.__dict__)
  File "C:\Users\HaraldEllingsen\demo-face-gan\streamlit_app.py", line 227, in <module>
    main()
[requirements.txt](https://github.com/streamlit/demo-face-gan/files/9306758/requirements.txt)

  File "C:\Users\HaraldEllingsen\demo-face-gan\streamlit_app.py", line 28, in main
    session, pg_gan_model = load_pg_gan_model()
  File "C:\Users\HaraldEllingsen\demo-face-gan\venv\lib\site-packages\streamlit\caching\cache_utils.py", line 145, in wrapper
    return get_or_create_cached_value()
  File "C:\Users\HaraldEllingsen\demo-face-gan\venv\lib\site-packages\streamlit\caching\cache_utils.py", line 137, in get_or_create_cached_value
    return_value = func(*args, **kwargs)
  File "C:\Users\HaraldEllingsen\demo-face-gan\streamlit_app.py", line 137, in load_pg_gan_model
    config = tf.ConfigProto(allow_soft_placement=True)
AttributeError: module 'tensorflow' has no attribute 'ConfigProto'
2022-08-11 08:45:05.428 Uncaught app exception
Traceback (most recent call last):
  File "C:\Users\HaraldEllingsen\demo-face-gan\venv\lib\site-packages\streamlit\caching\cache_utils.py", line 126, in get_or_create_cached_value
    return_value = cache.read_value(value_key)
  File "C:\Users\HaraldEllingsen\demo-face-gan\venv\lib\site-packages\streamlit\caching\singleton_decorator.py", line 262, in read_value
    raise CacheKeyNotFoundError()
streamlit.caching.cache_errors.CacheKeyNotFoundError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\HaraldEllingsen\demo-face-gan\venv\lib\site-packages\streamlit\scriptrunner\script_runner.py", line 557, in _run_script
    exec(code, module.__dict__)
  File "C:\Users\HaraldEllingsen\demo-face-gan\streamlit_app.py", line 227, in <module>
    main()
  File "C:\Users\HaraldEllingsen\demo-face-gan\streamlit_app.py", line 28, in main
    session, pg_gan_model = load_pg_gan_model()
  File "C:\Users\HaraldEllingsen\demo-face-gan\venv\lib\site-packages\streamlit\caching\cache_utils.py", line 145, in wrapper
    return get_or_create_cached_value()
  File "C:\Users\HaraldEllingsen\demo-face-gan\venv\lib\site-packages\streamlit\caching\cache_utils.py", line 137, in get_or_create_cached_value
    return_value = func(*args, **kwargs)
  File "C:\Users\HaraldEllingsen\demo-face-gan\streamlit_app.py", line 137, in load_pg_gan_model
    config = tf.ConfigProto(allow_soft_placement=True)
AttributeError: module 'tensorflow' has no attribute 'ConfigProto'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.