Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,3 +10,54 @@ urls = {
|
|
| 10 |
|
| 11 |
for name, url in urls.items():
|
| 12 |
st.write(f"- [{name}]({url})")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
for name, url in urls.items():
|
| 12 |
st.write(f"- [{name}]({url})")
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
import streamlit as st
|
| 16 |
+
import tensorflow as tf
|
| 17 |
+
from tensorflow.keras.preprocessing import image
|
| 18 |
+
import numpy as np
|
| 19 |
+
import pycuda.autoinit
|
| 20 |
+
import pycuda.driver as cuda
|
| 21 |
+
import tensorrt as trt
|
| 22 |
+
import nvtabular as nvt
|
| 23 |
+
import nvidia.dali as dali
|
| 24 |
+
import nvidia.dali.ops as ops
|
| 25 |
+
import nvidia.dali.types as types
|
| 26 |
+
import deepstream as ds
|
| 27 |
+
|
| 28 |
+
# Set up the Streamlit app
|
| 29 |
+
st.set_page_config(page_title="Deep Learning Libraries Demo")
|
| 30 |
+
|
| 31 |
+
# NVIDIA cuDNN
|
| 32 |
+
st.header("NVIDIA cuDNN")
|
| 33 |
+
st.write("cuDNN is a GPU-accelerated library of primitives for deep neural networks.")
|
| 34 |
+
|
| 35 |
+
# NVIDIA TensorRT
|
| 36 |
+
st.header("NVIDIA TensorRT")
|
| 37 |
+
st.write("TensorRT is a high-performance deep learning inference optimizer and runtime for production deployment.")
|
| 38 |
+
|
| 39 |
+
# NVIDIA Riva
|
| 40 |
+
st.header("NVIDIA Riva")
|
| 41 |
+
st.write("Riva is a platform for developing engaging and contextual AI-powered conversation apps.")
|
| 42 |
+
|
| 43 |
+
# NVIDIA DeepStream SDK
|
| 44 |
+
st.header("NVIDIA DeepStream SDK")
|
| 45 |
+
st.write("DeepStream is a real-time streaming analytics toolkit for AI-based video understanding and multi-sensor processing.")
|
| 46 |
+
|
| 47 |
+
# NVIDIA DALI
|
| 48 |
+
st.header("NVIDIA DALI")
|
| 49 |
+
st.write("DALI is a portable, open-source library for decoding and augmenting images and videos to accelerate deep learning applications.")
|
| 50 |
+
|
| 51 |
+
# Load an image and run it through a pre-trained model
|
| 52 |
+
st.header("Example: Image Classification with TensorFlow")
|
| 53 |
+
model = tf.keras.applications.MobileNetV2()
|
| 54 |
+
img_path = "example.jpg"
|
| 55 |
+
img = image.load_img(img_path, target_size=(224, 224))
|
| 56 |
+
x = image.img_to_array(img)
|
| 57 |
+
x = np.expand_dims(x, axis=0)
|
| 58 |
+
x = tf.keras.applications.mobilenet_v2.preprocess_input(x)
|
| 59 |
+
preds = model.predict(x)
|
| 60 |
+
st.write(f"Predicted class: {tf.keras.applications.mobilenet_v2.decode_predictions(preds, top=1)[0][0][1]}")
|
| 61 |
+
|
| 62 |
+
# Clean up
|
| 63 |
+
del model, img, x, preds
|