Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Commit

Permalink
chore: cleanup for API and Bots
Browse files Browse the repository at this point in the history
    - cleanup for API and Bots
  • Loading branch information
aditya-jetely-07 committed Oct 3, 2023
1 parent 47fdee5 commit aa94377
Show file tree
Hide file tree
Showing 170 changed files with 5,141 additions and 604 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- Make a virtual environment and activate it (suggested, can be skipped)
- Get the code on your machine
- Clone the repo `git clone https://github.com/Python-World/Python_and_the_Web.git`
- Move to this directory `cd Python_and_the_Web/Scripts/API/Random_Joke`
- Move to this directory `cd Python_and_the_Web/Scripts/API/Random Joke`
- Install requirements `pip install -r requirements.txt`
- Run it! `python joke.py` (on linux it's possible to run it with `./joke.py` too but you'll need to `chroot +x joke.py`)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
8 changes: 0 additions & 8 deletions Scripts/API/simple_api_requests/README.md

This file was deleted.

28 changes: 0 additions & 28 deletions Scripts/API/simple_api_requests/main.py

This file was deleted.

2 changes: 0 additions & 2 deletions Scripts/API/simple_api_requests/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion Scripts/API/wikipedia/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This script helps to fetch data from wikipedia API and provides it in a structur
3. OR you can use the parser by calling method ``` get_all_wiki(query) ```

### Screenshot/GIF showing the sample use of the script
![Alt Screenshot](https://github.com/MNISAR/Python_and_the_Web/blob/master/Scripts/API/wikipedia/output.png "output")
![Alt Screenshot](https://github.com/MNISAR/Python_and_the_Web/blob/master/Scripts/API/Wikipedia/output.png "output")

## *Author Name*
[MNISAR](https://www.github.com/MNISAR)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
"outputs": [],
"source": [
"from tensorflow.keras.models import Sequential\n",
"from tensorflow.keras.layers import Conv2D, MaxPooling2D, Dropout, Flatten, Dense\n",
"from tensorflow.keras.layers import (\n",
" Conv2D,\n",
" MaxPooling2D,\n",
" Dropout,\n",
" Flatten,\n",
" Dense,\n",
")\n",
"from tensorflow.keras.metrics import categorical_crossentropy\n",
"from tensorflow.keras.preprocessing.image import ImageDataGenerator"
]
Expand Down Expand Up @@ -42,11 +48,13 @@
"metadata": {},
"outputs": [],
"source": [
"train_data_generator = ImageDataGenerator(rescale=1./255,\n",
" rotation_range=20,\n",
" shear_range=0.2,\n",
" zoom_range=0.2,\n",
" horizontal_flip=True)"
"train_data_generator = ImageDataGenerator(\n",
" rescale=1.0 / 255,\n",
" rotation_range=20,\n",
" shear_range=0.2,\n",
" zoom_range=0.2,\n",
" horizontal_flip=True,\n",
")"
]
},
{
Expand All @@ -55,7 +63,7 @@
"metadata": {},
"outputs": [],
"source": [
"test_data_generator = ImageDataGenerator(rescale=1./255)"
"test_data_generator = ImageDataGenerator(rescale=1.0 / 255)"
]
},
{
Expand All @@ -72,11 +80,13 @@
}
],
"source": [
"training_data = train_data_generator.flow_from_directory(directory=train_data_path, \n",
" target_size=(48, 48),\n",
" color_mode='grayscale',\n",
" class_mode='categorical',\n",
" batch_size=64)"
"training_data = train_data_generator.flow_from_directory(\n",
" directory=train_data_path,\n",
" target_size=(48, 48),\n",
" color_mode=\"grayscale\",\n",
" class_mode=\"categorical\",\n",
" batch_size=64,\n",
")"
]
},
{
Expand All @@ -93,11 +103,13 @@
}
],
"source": [
"testing_data = test_data_generator.flow_from_directory(directory=test_data_path, \n",
" target_size=(48, 48),\n",
" color_mode='grayscale',\n",
" class_mode='categorical',\n",
" batch_size=64)"
"testing_data = test_data_generator.flow_from_directory(\n",
" directory=test_data_path,\n",
" target_size=(48, 48),\n",
" color_mode=\"grayscale\",\n",
" class_mode=\"categorical\",\n",
" batch_size=64,\n",
")"
]
},
{
Expand Down Expand Up @@ -142,17 +154,19 @@
"metadata": {},
"outputs": [],
"source": [
"model.add(Conv2D(32, 3, input_shape=(48, 48, 1), activation='relu', padding='same'))\n",
"model.add(\n",
" Conv2D(32, 3, input_shape=(48, 48, 1), activation=\"relu\", padding=\"same\")\n",
")\n",
"model.add(MaxPooling2D((2, 2), strides=2))\n",
"model.add(Conv2D(64, 3, activation='relu', padding='same'))\n",
"model.add(Conv2D(64, 3, activation=\"relu\", padding=\"same\"))\n",
"model.add(Dropout(0.2))\n",
"model.add(MaxPooling2D((2, 2), strides=2))\n",
"model.add(Conv2D(64, 3, activation='relu', padding='same'))\n",
"model.add(Conv2D(64, 3, activation=\"relu\", padding=\"same\"))\n",
"model.add(Dropout(0.2))\n",
"model.add(MaxPooling2D((2, 2), strides=2))\n",
"model.add(Conv2D(128, 3, activation='relu', padding='same'))\n",
"model.add(Conv2D(128, 3, activation=\"relu\", padding=\"same\"))\n",
"model.add(Flatten())\n",
"model.add(Dense(4, activation='softmax'))"
"model.add(Dense(4, activation=\"softmax\"))"
]
},
{
Expand Down Expand Up @@ -214,7 +228,9 @@
"metadata": {},
"outputs": [],
"source": [
"model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])"
"model.compile(\n",
" optimizer=\"adam\", loss=\"categorical_crossentropy\", metrics=[\"accuracy\"]\n",
")"
]
},
{
Expand Down Expand Up @@ -868,8 +884,14 @@
}
],
"source": [
"model.fit_generator(training_data, validation_data=testing_data, epochs=300, steps_per_epoch=len(training_data), \n",
" validation_steps=len(testing_data), verbose=1)"
"model.fit_generator(\n",
" training_data,\n",
" validation_data=testing_data,\n",
" epochs=300,\n",
" steps_per_epoch=len(training_data),\n",
" validation_steps=len(testing_data),\n",
" verbose=1,\n",
")"
]
},
{
Expand Down
Loading

0 comments on commit aa94377

Please sign in to comment.