Downloads · 30 days
0
nawazmohd/RAZZER-AI
RAZZER-AI is a machine learning model from nawazmohd. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
import gradio as gr from transformers import pipeline from tensorflow.keras.applications.mobilenetv2 import MobileNetV2, preprocessinput, decodepredictions from tensorflow.keras.preprocessing import image import numpy…
Downloads · 30 days
0
Access
Public
Updated Sep 13, 2025
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md2.1 KB · 58%
From the Hugging Face model README
import gradio as gr from transformers import pipeline from tensorflow.keras.applications.mobilenet_v2 import MobileNetV2, preprocess_input, decode_predictions from tensorflow.keras.preprocessing import image import numpy as np
chatbot = pipeline("text-generation", model="gpt2")
def chat_with_ai(user_input): response = chatbot(user_input, max_length=100, do_sample=True, top_k=50)[0]['generated_text'] return response
model = MobileNetV2(weights="imagenet")
def classify_image(img): img = image.img_to_array(img) img = np.expand_dims(img, axis=0) img = preprocess_input(img) preds = model.predict(img) results = decode_predictions(preds, top=3)[0] return {label: float(prob) for (_, label, prob) in results}
with gr.Blocks() as demo: gr.Markdown("## 🤖 AI App: Chatbot + Image Recognition")
with gr.Tab("Chatbot"):
chatbot_input = gr.Textbox(label="Type your message")
chatbot_output = gr.Textbox(label="AI Response")
chatbot_btn = gr.Button("Send")
chatbot_btn.click(chat_with_ai, inputs=chatbot_input, outputs=chatbot_output)
with gr.Tab("Image Recognition"):
img_input = gr.Image(type="pil", label="Upload an Image")
img_output = gr.Label(label="Top Predictions")
img_btn = gr.Button("Classify")
img_btn.click(classify_image, inputs=img_input, outputs=img_output)
demo.launch()